package gen1us.jutw.CreateConfig;


/*
Copyright 2009 Evgeny Yusov

This file is part of JUTW.

JUTW is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

JUTW is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with JUTW.  If not, see http://www.gnu.org/licenses/.
*/

class Property {
	/**
	 * Create new property
	 * @param param	Parameter name example: "tuser"
	 * @param desc	Description exemple: "Twitter user"
	 * @param passView is password
	 * @param value Value
	 * @param length Length of text field
	 */
	public Property(String param, String desc, Boolean passView, String value, int length) {
		this.desc = desc;
		this.param = param;
		this.length = length;
		this.value = value;
		this.passView = passView;
		
		writer = 0;
	}
	
	public Property(String param, String desc) {
		this(param, desc, false, "", DEF_LENGTH);
	}
	
	public Property(String param, String desc, Boolean passView, String defValue){
		this(param, desc, false, defValue, DEF_LENGTH);
	}
	
	public Property(String param, String desc, Boolean passView){
		this(param, desc, passView, "", DEF_LENGTH);
	}

	public Property(String param, String desc, int writer) {
	    this(param, desc);
	    this.writer = writer;
	}
	
	public String getDesc(){
		return desc;
	}
	
	public String getParam(){
		return param;
	}
	
	public int getLength(){
		return length;
	}
	
	public String getValue(){
		return value;
	}
	
	public int getWriter() {
	    return writer;
	}
	
	public void setPassView(Boolean b){
		passView = b;
	}
	
	public Boolean getPassView(){
		return passView;
	}
	
	public void setValue(String s){
		value = s;
	}

	public void setRequired(int isRequired){
		this.isRequired = isRequired;
	}
	
	public int isRequired(){
		return isRequired;
	}
	
	static final int OPTIONAL = 0;
	static final int REQUIRED = 1;
	private int isRequired;
	private int writer;
	private Boolean passView;
	private final String desc;
	private final String param;
	private final int length;
	private String value;
	private static final int DEF_LENGTH = 15;
}
